package com.ssm.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.pojo.collect.Collect;
import com.ssm.pojo.collect.CollectAddResponseParameter;
import com.ssm.pojo.collect.CollectDeleteResponseParameter;
import com.ssm.pojo.collect.CollectListResponseParameter;
import com.ssm.service.CollectService;
 

@Controller
public class CollectController {
	 @Autowired
	 CollectService collectService;
	 
	  // 商品收藏列表
	  @RequestMapping(value="collect")
	  public String collect() {
		return "collect/collectList";
	  }
	
	  // 新增商品收藏API
	  @RequestMapping(value="/api/v1/user/add/wishlist",method = RequestMethod.POST)
	  @ResponseBody
	  public CollectAddResponseParameter add(Collect collect){
		 return collectService.add(collect);
	  }

	  // 获取商品收藏API
	  @RequestMapping(value="/api/v1/user/wishlist",method = RequestMethod.POST)
	  @ResponseBody
	  public CollectListResponseParameter list(int id) {
		return collectService.list(id);
	  }
	  
	  // 删除商品收藏API
	  @RequestMapping(value="/api/v1/user/remove/wishlist",method = RequestMethod.POST)
	  @ResponseBody
	  public CollectDeleteResponseParameter delete(int id) {
		return collectService.delete(id);
	  }
}